package com.example.xd.javatest.jvm_test;

import java.util.ArrayList;
import java.util.List;

/**
 * @auther XuDan on 2020/6/17.
 * java堆溢出 OOM(java heap space)
 */
public class HeapOOM {
    public static class OOMObj {
    }


    public static void main(String[] args) {
        int count = 0;

        List<OOMObj> oomObjs = new ArrayList<>();
        while (true) {
            oomObjs.add(new OOMObj());
            System.out.println(count++);
        }
    }
}
